Echo = $FFEF
Monitor = $FF1F

  LDA #<welcome        ;  Load low byte of string's addr
  STA $00              ;  Save addr to $00
  LDA #>welcome        ;  Load high byte of string's addr
  STA $01              ;  Save addr to $01
  JSR printsub         ;  Print the string

  LDA #<goodbye        ;  Load low byte of string's addr
  STA $00              ;  Save addr to $00
  LDA #>goodbye        ;  Load high byte of string's addr
  STA $01              ;  Save addr to $01
  JSR printsub         ;  Print the string

  JMP Monitor          ;  Return to Monitor


/* Strings */

welcome:
  .asc "Welcome to the Apple I",$0D,$00  ; $0D is carriage return; $00 is NULL

goodbye:
  .asc "That was a short demo.",$00


/*
Name:               PrintSub
Precondtions:       Address of string to print is stored at $00,$01.
Postcondtions:      The string is printed to screen.
Destroys:           A, Y, Flags.
Description:        Prints the string at the address at $00,$01.
*/

printsub:
  LDY #$00          ;  Our loop expects X to start at 0
printchar:
  LDA ($00),Y       ;  Load the next character
  CMP #$00          ;  Compare char to NULL ($00)
  BEQ doneprintsub  ;  If NULL break out of loop
  JSR Echo          ;  If not NULL, print the character
  INY               ;  Increment X, so we can get at the next character
  JMP printchar     ;  Loop again 
doneprintsub:
  RTS
